<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>营养知识 - 营养健康系统</title>
    <!-- Tailwind CSS CDN -->
    <script src="https://cdn.tailwindcss.com"></script>
    <!-- 自定义配置 -->
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: {
                            50: '#f0fdf4',
                            100: '#dcfce7',
                            200: '#bbf7d0',
                            300: '#86efac',
                            400: '#4ade80',
                            500: '#22c55e',
                            600: '#16a34a',
                            700: '#15803d',
                            800: '#166534',
                            900: '#14532d',
                        },
                        secondary: {
                            50: '#f8fafc',
                            100: '#f1f5f9',
                            200: '#e2e8f0',
                            300: '#cbd5e1',
                            400: '#94a3b8',
                            500: '#64748b',
                            600: '#475569',
                            700: '#334155',
                            800: '#1e293b',
                            900: '#0f172a',
                        }
                    },
                    fontFamily: {
                        sans: ['Inter', 'system-ui', 'sans-serif'],
                    },
                }
            }
        }
    </script>
    <!-- 字体 -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap">
    <!-- Font Awesome CDN -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    <!-- 图标 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/remixicon@3.5.0/fonts/remixicon.css">
</head>
<body class="bg-gray-50">
    <!-- 导航栏 -->
    <nav class="bg-green-600 text-white shadow-lg">
        <div class="container mx-auto px-4 py-3 flex justify-between items-center">
            <div class="flex items-center">
                <svg class="h-10 w-10 mr-3" viewBox="0 0 100 100">
                    <circle cx="50" cy="50" r="45" fill="#4CAF50" />
                    <text x="50" y="55" font-size="20" text-anchor="middle" fill="white">营养</text>
                    <path d="M30,70 Q50,90 70,70" stroke="white" stroke-width="3" fill="none" />
                </svg>
                <h1 class="text-xl font-bold">营养健康系统</h1>
            </div>
            <div class="hidden md:flex space-x-6">
                <a href="../index.html" class="hover:text-green-200">
                    <i class="fas fa-home mr-1"></i>首页
                </a>
                <a href="food-analysis.html" class="hover:text-green-200">
                    <i class="fas fa-apple-alt mr-1"></i>食品分析
                </a>
                <a href="health-profile.html" class="hover:text-green-200">
                    <i class="fas fa-heartbeat mr-1"></i>健康档案
                </a>
                <a href="diet-records.html" class="hover:text-green-200">
                    <i class="fas fa-utensils mr-1"></i>饮食记录
                </a>
                <a href="nutrition-charts.html" class="hover:text-green-200">
                    <i class="fas fa-chart-pie mr-1"></i>营养图表
                </a>
                <a href="knowledge-graph.html" class="hover:text-green-200">
                    <i class="fas fa-project-diagram mr-1"></i>知识图谱
                </a>
            </div>
            <div class="flex items-center space-x-4 nav-user-section">
                <!-- 这里的内容将由auth.js动态更新 -->
                <a href="login.html" class="hover:text-green-200">登录</a>
                <a href="register.html" class="bg-white text-green-600 px-4 py-2 rounded-lg hover:bg-green-100">注册</a>
            </div>
        </div>
    </nav>

    <!-- 主要内容 -->
    <main class="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
        <!-- 页面标题 -->
        <div class="px-4 sm:px-0">
            <h1 class="text-2xl font-semibold text-secondary-900">营养知识</h1>
            <p class="mt-1 text-sm text-secondary-500">
                了解食品营养成分和健康饮食的相关知识
            </p>
        </div>

        <!-- 搜索栏 -->
        <div class="mt-6 px-4 sm:px-0">
            <div class="relative">
                <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                    <i class="ri-search-line text-secondary-400"></i>
                </div>
                <input type="text" name="search" id="search" class="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md leading-5 bg-white placeholder-secondary-500 focus:outline-none focus:placeholder-secondary-400 focus:ring-1 focus:ring-primary-500 focus:border-primary-500 sm:text-sm" placeholder="搜索营养知识...">
            </div>
        </div>

        <!-- 知识分类 -->
        <div class="mt-6 px-4 sm:px-0">
            <div class="flex flex-wrap gap-2">
                <button type="button" class="inline-flex items-center px-3 py-1.5 border border-transparent text-xs font-medium rounded-full shadow-sm text-white bg-primary-600 hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
                    全部
                </button>
                <button type="button" class="inline-flex items-center px-3 py-1.5 border border-gray-300 text-xs font-medium rounded-full shadow-sm text-secondary-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
                    营养素
                </button>
                <button type="button" class="inline-flex items-center px-3 py-1.5 border border-gray-300 text-xs font-medium rounded-full shadow-sm text-secondary-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
                    食品分类
                </button>
                <button type="button" class="inline-flex items-center px-3 py-1.5 border border-gray-300 text-xs font-medium rounded-full shadow-sm text-secondary-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
                    健康饮食
                </button>
                <button type="button" class="inline-flex items-center px-3 py-1.5 border border-gray-300 text-xs font-medium rounded-full shadow-sm text-secondary-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
                    特殊人群
                </button>
                <button type="button" class="inline-flex items-center px-3 py-1.5 border border-gray-300 text-xs font-medium rounded-full shadow-sm text-secondary-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">
                    常见问题
                </button>
            </div>
        </div>

        <!-- 文章列表 -->
        <div class="mt-8 px-4 sm:px-0">
            <div class="grid gap-6 lg:grid-cols-3 md:grid-cols-2 sm:grid-cols-1">
                <!-- 文章1 -->
                <div class="bg-white overflow-hidden shadow-sm rounded-lg">
                    <div class="h-48 overflow-hidden">
                        <img src="https://images.unsplash.com/photo-1490645935967-10de6ba17061?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80" alt="健康饮食" class="w-full h-full object-cover">
                    </div>
                    <div class="p-6">
                        <div class="flex items-center">
                            <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
                                健康饮食
                            </span>
                            <span class="ml-2 text-xs text-secondary-500">2025-03-20</span>
                        </div>
                        <h3 class="mt-2 text-lg font-medium text-secondary-900">均衡饮食的重要性</h3>
                        <p class="mt-2 text-sm text-secondary-500 line-clamp-3">
                            均衡饮食是指摄入各种食物，确保获取人体所需的所有营养素。一个均衡的饮食应包含适量的碳水化合物、蛋白质、脂肪、维生素和矿物质。本文将介绍如何构建一个均衡的饮食计划，以及均衡饮食对健康的重要性。
                        </p>
                        <div class="mt-4">
                            <a href="#" class="text-primary-600 hover:text-primary-500 text-sm font-medium">
                                阅读更多 <i class="ri-arrow-right-line align-middle"></i>
                            </a>
                        </div>
                    </div>
                </div>

                <!-- 文章2 -->
                <div class="bg-white overflow-hidden shadow-sm rounded-lg">
                    <div class="h-48 overflow-hidden">
                        <img src="https://images.unsplash.com/photo-1515543237350-b3eea1ec8082?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80" alt="蛋白质" class="w-full h-full object-cover">
                    </div>
                    <div class="p-6">
                        <div class="flex items-center">
                            <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
                                营养素
                            </span>
                            <span class="ml-2 text-xs text-secondary-500">2025-03-15</span>
                        </div>
                        <h3 class="mt-2 text-lg font-medium text-secondary-900">蛋白质：构建身体的基石</h3>
                        <p class="mt-2 text-sm text-secondary-500 line-clamp-3">
                            蛋白质是人体必需的大分子营养素，是构成人体组织的重要物质。它由氨基酸组成，参与体内几乎所有的生理活动。本文将介绍蛋白质的功能、来源以及每日摄入建议，帮助您了解如何合理摄入蛋白质。
                        </p>
                        <div class="mt-4">
                            <a href="#" class="text-primary-600 hover:text-primary-500 text-sm font-medium">
                                阅读更多 <i class="ri-arrow-right-line align-middle"></i>
                            </a>
                        </div>
                    </div>
                </div>

                <!-- 文章3 -->
                <div class="bg-white overflow-hidden shadow-sm rounded-lg">
                    <div class="h-48 overflow-hidden">
                        <img src="https://images.unsplash.com/photo-1498837167922-ddd27525d352?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80" alt="水果蔬菜" class="w-full h-full object-cover">
                    </div>
                    <div class="p-6">
                        <div class="flex items-center">
                            <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
                                食品分类
                            </span>
                            <span class="ml-2 text-xs text-secondary-500">2025-03-10</span>
                        </div>
                        <h3 class="mt-2 text-lg font-medium text-secondary-900">水果与蔬菜：色彩缤纷的健康源泉</h3>
                        <p class="mt-2 text-sm text-secondary-500 line-clamp-3">
                            水果和蔬菜富含维生素、矿物质、膳食纤维和抗氧化物质，是健康饮食的重要组成部分。研究表明，每天摄入足够的水果和蔬菜可以降低患心脏病、中风和某些癌症的风险。本文将介绍不同颜色的水果和蔬菜所含的营养成分及其健康益处。
                        </p>
                        <div class="mt-4">
                            <a href="#" class="text-primary-600 hover:text-primary-500 text-sm font-medium">
                                阅读更多 <i class="ri-arrow-right-line align-middle"></i>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 营养小贴士 -->
        <div class="mt-12 px-4 sm:px-0">
            <h2 class="text-lg font-medium text-secondary-900">营养小贴士</h2>
            <div class="mt-4 grid gap-4 md:grid-cols-2">
                <div class="bg-primary-50 p-4 rounded-md">
                    <div class="flex">
                        <div class="flex-shrink-0">
                            <i class="ri-lightbulb-line text-primary-600 text-xl"></i>
                        </div>
                        <div class="ml-3">
                            <h4 class="text-sm font-medium text-primary-800">多喝水</h4>
                            <p class="mt-1 text-sm text-primary-700">
                                保持充足的水分摄入对健康至关重要。成年人每天应该喝约8杯水（约2升）。水有助于调节体温、润滑关节、保护敏感组织，并帮助排出体内废物。
                            </p>
                        </div>
                    </div>
                </div>
                <div class="bg-primary-50 p-4 rounded-md">
                    <div class="flex">
                        <div class="flex-shrink-0">
                            <i class="ri-lightbulb-line text-primary-600 text-xl"></i>
                        </div>
                        <div class="ml-3">
                            <h4 class="text-sm font-medium text-primary-800">控制食盐摄入</h4>
                            <p class="mt-1 text-sm text-primary-700">
                                过多的盐摄入会增加高血压风险。世界卫生组织建议成年人每天食盐摄入量不超过5克（约一茶匙）。尽量减少加工食品的摄入，因为它们通常含有较高的盐分。
                            </p>
                        </div>
                    </div>
                </div>
                <div class="bg-primary-50 p-4 rounded-md">
                    <div class="flex">
                        <div class="flex-shrink-0">
                            <i class="ri-lightbulb-line text-primary-600 text-xl"></i>
                        </div>
                        <div class="ml-3">
                            <h4 class="text-sm font-medium text-primary-800">限制添加糖</h4>
                            <p class="mt-1 text-sm text-primary-700">
                                过多的添加糖会增加肥胖、糖尿病和心脏病的风险。世界卫生组织建议添加糖的摄入量应限制在每日总能量摄入的10%以下，最好控制在5%以下。
                            </p>
                        </div>
                    </div>
                </div>
                <div class="bg-primary-50 p-4 rounded-md">
                    <div class="flex">
                        <div class="flex-shrink-0">
                            <i class="ri-lightbulb-line text-primary-600 text-xl"></i>
                        </div>
                        <div class="ml-3">
                            <h4 class="text-sm font-medium text-primary-800">选择健康脂肪</h4>
                            <p class="mt-1 text-sm text-primary-700">
                                不是所有的脂肪都是有害的。不饱和脂肪（如橄榄油、坚果和鱼类中的脂肪）对健康有益。尽量减少饱和脂肪和反式脂肪的摄入，它们会增加心脏病风险。
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <!-- 页脚 -->
    <footer class="bg-white mt-12">
        <div class="max-w-7xl mx-auto py-12 px-4 overflow-hidden sm:px-6 lg:px-8">
            <p class="mt-8 text-center text-base text-secondary-400">
                &copy; 2025 营养健康管理系统. 保留所有权利.
            </p>
        </div>
    </footer>

    <!-- JavaScript -->
    <script src="../js/api-service.js"></script>
    <script src="../js/auth.js"></script>
    <script src="../js/main.js"></script>
    <script>
        // 移动端菜单切换
        document.addEventListener('DOMContentLoaded', function() {
            const mobileMenuButton = document.getElementById('mobile-menu-button');
            if (mobileMenuButton) {
                mobileMenuButton.addEventListener('click', function() {
                    const mobileMenu = document.getElementById('mobile-menu');
                    if (mobileMenu) {
                        mobileMenu.classList.toggle('hidden');
                    }
                });
            }
        });
    </script>
</body>
</html>